#include"DSP_chip.h"

DSP_cluster* DSP_chip::get_cluster(int cluster_id) {
    return this->DSP_clusters->at(cluster_id);
}

int DSP_chip::open_dev(int cluster_id, pid_t pid) {
    this->DSP_clusters->at(cluster_id) = new DSP_cluster();
    this->PIDs->at(cluster_id) = pid;
    return 0;
}

int DSP_chip::close_dev(int cluster_id) {
    delete this->DSP_clusters->at(cluster_id);
    return 0;
}

void DSP_chip::init_Cluster(int cluster_id) {
    this->DSP_clusters->at(cluster_id) = new DSP_cluster();
}

void DSP_chip::destroy_Cluster(int cluster_id) {
    delete this->DSP_clusters->at(cluster_id);
}

// int DSP_chip::dev_owner(int cluster_id) {
//     if (this->DSP_clusters->at(cluster_id) != nullptr) {
//         return this->PIDs->at(cluster_id);
//     } else {
//         return 0;
//     }
// }